﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Web.UI;

using LMD.Constant;
using LMD.Lib.Controls;

public class LOV_ContactPerson : LMD.Lib.Interface.ILOVProvider
{
    public LOV_ContactPerson()
    {
        //
        // TODO: Add constructor logic here
        //
    }

    #region ILOVProvider Members

    public String DrawLOV(string sxControlId, string sxFilter, string sxCustomParam, int iIndex, int iPageSize)
    {
        String[] sxSplitted = sxFilter.Split(new String[] {KGlobal.DELIMITER}, StringSplitOptions.None);
        
        String sxName = sxSplitted[0].Trim();

        int iCompanyId = int.Parse(sxCustomParam);
        Cached.ContactPersonTable cpt = new Cached.ContactPersonTable();
        
        DataTable dt = cpt.GetContactPersonList(iCompanyId);

        return CustomControls.Create_LOVTabular(sxControlId, dt, iIndex, iPageSize, sxName, "ID_COMBINED", "NAME", "ShowSelectedContactData()", false);
    }


    public String ShowInputForm(string sxControlId, string sxValue, string sxCustomParam)
    {
        // DI SINI BUAT FORM BUAT INPUT CONTACT PERSON BARU

        String sxOutput = String.Empty;
        sxOutput = CustomControls.BuildEditor_PopupNewLOVItem(sxControlId, GetLOVName(), sxValue, false);
        return sxOutput;
    }

    public string GetLOVName()
    {
        return KLOV.Generic.CONTACTPERSON;
    }

    public string Insert2LOV(string sxValue, string sxCustomParam, TextboxType tpTextbox)
    {
        throw new NotImplementedException();
    }

    #endregion
}
